package com.qiyueoffice.util;

import java.io.IOException;
import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class SqlMapUtil
{
    private String resource = "sqlmap-config.xml";

    public SqlMapClient getSqlMapClient()
    {
        SqlMapClient sqlMap = null;
        try
        {
            Reader reader = Resources.getResourceAsReader(resource);
            sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return sqlMap;
    }
}
